package com.yuerenjf.yuerenjinfu.adapter;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.yuerenjf.yuerenjinfu.R;
import com.yuerenjf.yuerenjinfu.bean.FindTogetherBean;

import java.util.List;

/**
 * Created by Administrator on 2017/6/13 0013.
 */

public class AdapterTogether extends BaseAdapter{
    Activity mActivity;
    private List<FindTogetherBean> beanList;
    public AdapterTogether(Activity mActivity, List<FindTogetherBean> beanList){
        this.mActivity=mActivity;
        this.beanList=beanList;
    }

    @Override
    public int getCount() {
        return beanList.size();
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        View convertView=null;ViewHolder viewHolder;
        if(convertView==null){
           viewHolder=new ViewHolder();
            convertView= LayoutInflater.from(mActivity).inflate(R.layout.item_find_together,null);
            viewHolder.imageView= (ImageView) convertView.findViewById(R.id.item_find_together_image);
            convertView.setTag(viewHolder);
        }else{
            viewHolder= (ViewHolder) convertView.getTag();
        }

        FindTogetherBean bean=beanList.get(i);
        viewHolder.imageView.setImageResource(bean.getImageRes());

        return convertView;
    }

    class ViewHolder{
        ImageView imageView;
        TextView textView;

        public ViewHolder() {
        }

    }
}
